package engine.logic.tips
{
	import engine.data.ModelLocator;
	import engine.tip.TipsMainLogic;
	
	import newx.com.config.StaticIni;

	public class SkillTips
	{
		private const COLOR_TABLE:Array	=	["","#ffffff'>","#1eff00'>","#0070dd'>","#a335ee'>","#ff8000'>","#e5cc80'>"];
		private var model			:ModelLocator;
		public function SkillTips()
		{
			model		=	ModelLocator.getInstance();
		}
		/**
		 * 
		 * @param configID 
		 * @param nextConfigID 
		 * @param tipsBool 为false的时候，表示数据为鼠标划过技能升级栏得到
		 * @return 
		 * 
		 */		
		public function getStr(configID:uint,nextConfigID:uint = -1,tipsBool:Boolean= true):String
		{
			var str:String		=	"";	
			var needSkillStr:String	=	"";
			var	upSkillGlod:String	=	"";
			if(tipsBool == true)
			{
				if(configID	==	0)
				{
					TipsMainLogic.instance.hide();
					return "";
				}
				str 			= str.concat(StaticIni.getSwfLangStr("SkillDes_" + configID));
				return str;
			}
			
			if(configID		==	0)
			{
				str				=	StaticIni.getSwfLangStr("UIStr_1001751")+StaticIni.getSwfLangStr("UIStr_1001754");
			}
			else
			{
				str				=	StaticIni.getSwfLangStr("UIStr_1001751");
				str				= 	str.concat("<br>");
				str 			=   str.concat(StaticIni.getSwfLangStr("SkillDes_" + configID));
			}
			str				= 	str.concat("<br>");
			if (nextConfigID	== 0)
			{
				str				= 	str.concat("<br>");
				str 			=    str.concat(StaticIni.getSwfLangStr("UIStr_1001752")+StaticIni.getSwfLangStr("UIStr_1001755"));
			}
			else
			{
				str				= 	str.concat("<br>");
				str 			= 	str.concat(StaticIni.getSwfLangStr("UIStr_1001752"));
				str				= 	str.concat("<br>");
				str 			=   str.concat(StaticIni.getSwfLangStr("SkillDes_" + nextConfigID));
			}
			str				= 	str.concat("<br>");
			//自己当前的钱
			var  roleGold:int 	=	model.scene.Role.GetProperties("GoldCoin");
			 
			//自己当前的技能经验
			var  roleSkillExp :int	=	model.scene.Role.GetProperties("SkillExp");
			
			//需要的升级经验
			var needSkillExp	:int	=	int(StaticIni.getIniVar(
				String(nextConfigID), "NeedExp"));
				
			str				= 	str.concat("<br>");
			if (roleSkillExp < needSkillExp)	
			{
				needSkillStr=	"<font color='#f00000'>" + String(needSkillExp) + "</font>";
				str			= 	str.concat(StaticIni.getSwfLangStr("UIStr_1001373") + needSkillStr);
			}
			else
			{
				needSkillStr=	"<font color='#1eff00'>" + String(needSkillExp) + "</font>";
				str			= 	str.concat(StaticIni.getSwfLangStr("UIStr_1001373") + needSkillStr);
			}
			
			//需要的钱	
			var needSkillGold:int		=	int(StaticIni.getIniVar(
				String(nextConfigID), "NeedGold"));	
			str				= 	str.concat("<br>");	
			if (roleGold < needSkillGold)
			{
				upSkillGlod	=	"<font color='#f00000'>" + String(needSkillGold) + "</font>";
				str			= 	str.concat(StaticIni.getSwfLangStr("UIStr_1001374") + upSkillGlod);
			}
			else
			{
				upSkillGlod	=	"<font color='#1eff00'>" + String(needSkillGold) + "</font>";
				str			= 	str.concat(StaticIni.getSwfLangStr("UIStr_1001374") + upSkillGlod);
			}
			//var nextLev:String	=	StaticIni.getIniVar(configID,"NextSkill");
//			var nameid	:String	=	StaticIni.getIniVar(configID,"NameID");
//			var mp		:String	=	StaticIni.getIniVar(configID,"ConsumeMP");
//			var cd		:String	=	StaticIni.getIniVar(configID,"CoolDownBout");
//			var needlv	:String	=	StaticIni.getIniVar(configID,"NeedLevel");
//			
//			var part1	:String	= StaticIni.getSwfLangStr("SkillDes_Consume_one");
//			var part2	:String	= StaticIni.getSwfLangStr("SkillDes_Consume_two");			
//			
//			part1	= part1.concat(mp);
//			part1	= part1.concat(part2);
//			part1	= link_color(part1,6);
//			
//			var part3	:String	= StaticIni.getSwfLangStr("SkillDes_CD_one");
//			var part4	:String	= StaticIni.getSwfLangStr("SkillDes_CD_two");
//			
//			part3	= part3.concat(cd);
//			part3	= part3.concat(part4);
//			part3	= link_color(part3,6);
//					
//			
//			str				= StaticIni.getSwfLangStr(nameid);
//			str				= str.concat("<br>");
//			str				= str.concat(part1);
//			str				= str.concat("<br>");
//			str				= str.concat(part3);
//			str				= str.concat("<br>");
//			temp			= StaticIni.getSwfLangStr("SkillDes_Learn");
//			temp			= temp.concat(needlv);
//			temp			= link_color(temp,3);
//			str				= str.concat("<br>");
//			str				= str.concat(temp);			
			return str;
		}
		
		private function link_color(str:String,color:int):String
		{
			if(color < 1 || color > 6)
			{
				color	=	1;
			}
			
			return ("<font color ='"+COLOR_TABLE[color]+str+"</font>");
		}
	}
}